package threading;

import java.util.Arrays;
import java.util.Scanner;
public class lianxi5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int maxNum = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0;i < n;i++){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int count = 0;
        int i,j;
        for(i = 0,j = n-1;i <= j;){
            if(a[j] + a[i] > maxNum){
                count++;
            }else{
                count++;
                i++;
            }
            j--;
        }
        System.out.println(count);
        return;
    }
}
